<?php
var_dump($_GET);

$appId='wxe214ac48790c622f';
$component_appid='wx82aa345f1fb8714b';
$code=$_GET['code'];

$get_access_token=json_decode(file_get_contents('./log/component_access_token.json'), true);
$component_access_token=$get_access_token['component_access_token'];

$url='https://api.weixin.qq.com/sns/oauth2/component/access_token?appid='.$appId.'&code='.$code.'&grant_type=authorization_code&component_appid='.$component_appid.'&component_access_token='.$component_access_token;
$getAccessToken=json_decode(file_get_contents($url),true);
var_dump($getAccessToken);
$accessToken=$getAccessToken['access_token'];
$openid=$getAccessToken['openid'];
echo $accessToken;
echo "<br />";
echo $openid;
echo "<br /><br />";

$userUrl='https://api.weixin.qq.com/sns/userinfo?access_token='.$accessToken.'&openid='.$openid.'&lang=zh_CN';
 
$getUserInfo=json_decode(file_get_contents($userUrl),true);
var_dump($getUserInfo);